﻿using System;
using System.Globalization;
using System.Linq;

namespace Kotonoha.Server.UI.Converters {
    public class IntToStringConverter : ValueConverterWithDesignerSupport {

        protected override object ConvertToCore(object value, Type type, object parameter, CultureInfo culture) {
            if (value == null) {
                return "";
            }
            return (int)value;
        }


        protected override object ConvertFromCore(object value, Type type, object parameter, CultureInfo culture) {
            if (value == null) {
                return 0;
            }
            return int.Parse((string)value);
        }

        protected override object GetDefaultValue(object parameter) {
            return "";
        }
    }
}
